{% extends "base.html" %}

{% block content %}

<script language="javascript" src="/static/js/jquery-1.2.1.pack.js" type="text/javascript"></script>
<script type="text/javascript" src="/static/js/jquery-calendar-pack.js" ></script>
<style type="text/css">@import url(/static/css/jquery-calendar.css);</style>

<script language=javascript>
$(document).ready(
	function()
	{
    	popUpCal.regional['zh-cn'] = {dateFormat: 'YMD-'};
		popUpCal.setDefaults(popUpCal.regional['zh-cn']);
	    $('#apply_time').calendar({autoPopUp: 'focus',yearRange: '-10:+0'});
	    $('#agent_id').change(function(){
		    var selText = $("#agent_id option:selected").text();
	    	if(selText=='Referred'){
	    		$('#refereeinfo').css('display','block');
	    	}else{
	    		$('#refereeinfo').css('display','none');
	    	}
		    
	    })
	}
);

function verify(form){
  if(form.name.value==""){
	alert("Enter the name please!");
	form.name.focus();		
       return false;
	}
  if(form.tel_h.value !=""||form.tel_o.value !=""||form.tel_m.value !=""){

	}
	else{
		alert("Enter tel please");
       return false;
	  }
	 if(form.email.value==0){
	alert("Enter email please");
	form.email.focus();		
       return false;
	}
// if(form.address.value==""){
//	alert("Enter Address please");
//	form.address.focus();		
//       return false;
//	}

return true;
 }

</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">
		<form name='form1' id='form1' action="/v2/savestudent/" method='post' onsubmit='return verify(this);'>
			<table width='650' class='grid' cellspacing='1' align='center'>
				<tr>
					<td colspan='2' class='title'>Add student</td>
				</tr>
				<tr valign='middle' align='left'></tr>
			
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'>Chinese Name:</td>
					<td class='even'><input type="text" name="name_ch" /></td>
				</tr>
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'>English Name:</td>
					<td class='even'><input type="text" name="name_en" /></td>
				</tr>
			
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'><font color="red">*</font>Tel:</td>
					<td class='even'><input type="text" name="tel_h" size="10" />(H)<input type="text" name="tel_o" size="10" />(O)<input type="text" name="tel_m" size="13" />(M)</td>
				</tr>
			
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'><font color="red">*</font>E-mail</td>
					<td class='even'><input type="text" name="email" /></td>
				</tr>
			 	
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'><font color="red">*</font>Address</td>
					<td class='even'><textarea name="address" cols="50" rows="2"></textarea></td>
				</tr>
				
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'>Programs</td>
					<td class='even'>
						<select name="program_id" style='color:#CC33FF'>
							 <option value="0">Choose plz</option>
							 {% for pj in pj %}
							   <option value="{{pj.id}}" {% ifequal pj.id p_id %} selected="selected" {% endifequal %}>{{pj.name}}</option>
							 {% endfor %}
						</select>
						<!--{% if p_id %} <input type='hidden' name="program_id" value="{{p_id}}" />{% endif %}-->
					</td>
				</tr>
				
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'>Apply Time</td>
					<td class='even'><input type="text" id="apply_time" name="apply_time"/></td>
				</tr>
				<!--<tr valign='middle' align='left'>
					<td class='odd' width='25%'>Education</td>
					<td class='even'>
						<select name="education">
							<option value="">Choose Education plz</option>
							<option value="1"> Secondary School</option>
							<option value="2">Diploma</option>
							<option value="3">Bachelor's Degree</option>
							<option value="4">Master's Degree</option>
							<option value="5">Ph.D.</option>
							</select>
					</td>
				</tr>
				
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'>Work Experience</td>
					<td class='even'><input type="text" name="work_experience" /> &nbsp; year ( Enter a mumber )</td>
				</tr>-->
				
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'>Agent</td>
					<td class='even'>
							<select name="agent_id" id="agent_id">
								<option value="1">Choose Agent plz</option>
								{% for agent in agent %}
								<option value="{{agent.id}}">{{agent.name}}</option>
				  				{% endfor %}
							</select>
							
							&nbsp;&nbsp;
							<span id="refereeinfo" style="display:none;float:right">
								referee
								<select name="referee_id" >
									<option value="-1">Choose Referee plz</option>
									{% for member in members %}
									<option value="{{member.id}}">{{member.name}}</option>
					  				{% endfor %}
								</select>
							</span>
					</td>
				</tr>
			
				<!--<tr valign='middle' align='left'>
					<td class='odd' width='25%'>Further Interest</td>
					<td class='even'>
						<select name="furtherinterest_id">
							<option value="0">Choose plz</option>
							  {% for fi in fi %}
							<option value="{{fi.id}}">{{fi.name}}</option>
							  {% endfor %}
						</select>
					</td>
				</tr>-->
				
				{% ifequal level 'administrators' %}
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'>belong to which sales</td>
					<td class='even'>
						<select name="salesperson_id">
						 <option value="0">Choose plz</option>
						  {% for sales in sales %}
						   <option value="{{sales.id}}">{{sales.name}}</option>
						  {% endfor %}
						</select>
					 </td>
				</tr>
				{%endifequal%}
				<tr valign='middle' align='left'>
				 	<td class='odd' width='25%'>Graduated</td>
					<td class='even'><input name="graduated" type="checkbox" value="1" />yes</td>
				</tr>
				<!--<tr valign='middle' align='left'>
					<td class='odd' width='25%'><font color='red'>(M&T)</font>Message</td>
					<td class='even'><textarea name="message" cols="40" rows="2"></textarea></td>
				</tr>-->
				<input type="hidden" name="back_url" value="/v2/stusearch" />
				<tr valign='middle' align='left'>
					<td class='odd' width='25%'></td>
					<td class='even'>&nbsp;
						<input type='submit' class='button' name='submit'  id='submit' value=' Submit '  />&nbsp;&nbsp;
						<input type='reset' class='button' name='reset'  id='reset' value=' Reset '  />
					</td>
				</tr>	
			</table>
		</form>
	</td>
  </tr>
</table>


{% endblock %}
